#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

int isNum(char *s)
{
  return (*s - '0') >= 0&&(*s - '0') <= 9;
}

int isLetter(char *s)
{
  return ((*s - 'a') >= 0&&(*s - 'z') <= 0)
    ||((*s - 'A') >= 0&&(*s - 'Z') <= 0);
}

int main(int argc,char **argv)
{

  char *s = "1asf23ab4c4567";
  char *begin;
  char *end;

  char *p;
  char *buf;
  char *buf_p;
  
 start:
  begin = s;
  end = s; 
  goto state0;
  
 state0:
  if(isNum(end))
    {
      end++;
      goto state1;
    }
  else
    {
      end++;
      goto start;
    }

 state1:
  if(isLetter(end))
    {
      end++;
      goto state1;
    }
  else
      goto state2;

 state2:
  if(isNum(end))
    goto state3;
  else
    goto start;

 state3:
  goto cbegin;

 cbegin:
  buf = (char *)malloc(end - begin + 2);
  memset(buf,0,end - begin  + 2);
  buf_p = buf;

  for(p = begin;p <= end;p++)
    *buf_p++ = *p;

  printf("%s\n",buf);
  //a test to test google code
  
  return 0;
}
